﻿Imports Microsoft.VisualBasic
Imports System.Xml.Serialization
Imports System.Globalization

<XmlRoot("WHOLE")>
Public Class RawEUXMLEntity
    Implements ISanctionListType

    <XmlAttributeAttribute("Date")>
    Public euDate As String

    Public ReadOnly Property getEuDate As Date
        Get
            Dim resDate As New Date
            Dim resParse = DateTime.TryParseExact(euDate, _
            "dd/MM/yyyy", CultureInfo.InvariantCulture, _
            DateTimeStyles.None, resDate)

            Return resDate
        End Get
    End Property

    ' Main Entity
    <XmlElement("ENTITY")>
    Public listEntity As New List(Of EUEntity)

    Public Class EUEntity
        <XmlAttributeAttribute("Id")>
        Public _id As Integer
        <XmlAttributeAttribute("programme")>
        Public programme As String
        <XmlAttributeAttribute("remark")>
        Public remark As String
        <XmlAttributeAttribute("Type")>
        Public type As String
        <XmlAttributeAttribute("reg_date")>
        Public reg_date As String

        'Name
        Private _euName As List(Of EUName)
        <XmlElement("NAME")>
        Public Property EUNameProperty() As List(Of EUName)
            Get
                Return _euName
            End Get
            Set(ByVal value As List(Of EUName))
                _euName = value
            End Set
        End Property

        'Address
        Private _euAddress As List(Of EUAddress)
        <XmlElement("ADDRESS")>
        Public Property EUAddressProperty() As List(Of EUAddress)
            Get
                Return _euAddress
            End Get
            Set(ByVal value As List(Of EUAddress))
                _euAddress = value
            End Set
        End Property

        'BirthInfo
        Private _euBirthInfo As List(Of EUBirthInfo)
        <XmlElement("BIRTH")>
        Public Property EUBirthProperty() As List(Of EUBirthInfo)
            Get
                Return _euBirthInfo
            End Get
            Set(ByVal value As List(Of EUBirthInfo))
                _euBirthInfo = value
            End Set
        End Property

        'ID Card Info
        Private _euIDCardInfo As List(Of EUIDCardInfo)
        <XmlElement("PASSPORT")>
        Public Property EUIDCardInfoProperty() As List(Of EUIDCardInfo)
            Get
                Return _euIDCardInfo
            End Get
            Set(ByVal value As List(Of EUIDCardInfo))
                _euIDCardInfo = value
            End Set
        End Property

        'Citizen
        Private _euCitizenList As List(Of EUCitizen)
        <XmlElement("CITIZEN")>
        Public Property EUCitizenList() As List(Of EUCitizen)
            Get
                Return _euCitizenList
            End Get
            Set(ByVal value As List(Of EUCitizen))
                _euCitizenList = value
            End Set
        End Property
    End Class

    Public Class EUName
        <XmlAttributeAttribute("Id")>
        Public _id As Integer
        <XmlElement("LASTNAME")>
        Public _lastName As String
        <XmlElement("FIRSTNAME")>
        Public _firstName As String
        <XmlElement("MIDDLENAME")>
        Public _middleName As String
        <XmlElement("WHOLENAME")>
        Public _wholeName As String
        <XmlElement("TITLE")>
        Public _title As String
        <XmlElement("FUNCTION")>
        Public _function As String
        <XmlElement("LANGUAGE")>
        Public _language As String
        <XmlElement("GENDER")>
        Public _euGender As String
    End Class

    Public Class EUAddress
        <XmlAttributeAttribute("Id")>
        Public _id As String
        <XmlElement("NUMBER")>
        Public _number As String
        <XmlElement("STREET")>
        Public _street As String
        <XmlElement("ZIPCODE")>
        Public _zipcode As String
        <XmlElement("CITY")>
        Public _city As String
        <XmlElement("COUNTRY")>
        Public _country As String
        <XmlElement("OTHER")>
        Public _other As String
        <XmlAttributeAttribute("programme")>
        Public _programme As String
    End Class

    Public Class EUBirthInfo
        <XmlAttributeAttribute("Id")>
        Public _id As String
        <XmlAttributeAttribute("programme")>
        Public _programme As String
        <XmlElement("DATE")>
        Public _date As String
        <XmlElement("PLACE")>
        Public _place As String
        <XmlElement("COUNTRY")>
        Public _country As String
    End Class

    Public Class EUIDCardInfo
        <XmlAttributeAttribute("Id")>
        Public _id As String
        <XmlAttributeAttribute("programme")>
        Public _programme As String
        <XmlElement("NUMBER")>
        Public _number As String
        <XmlElement("COUNTRY")>
        Public _country As String
    End Class

    Public Class EUCitizen
        <XmlAttributeAttribute("Id")>
        Public _id As String
        <XmlAttributeAttribute("programme")>
        Public _programme As String
        <XmlElement("COUNTRY")>
        Public _country As String
    End Class

    Public Function GetTypes() As sanctionListType Implements ISanctionListType.GetTypes
        Return sanctionListType.EU
    End Function
End Class
